# Contributor: Fabio Ribeiro <fabiorphp@gmail.com>
# Maintainer: Andy Postnikov <apostnikov@gmail.com>
pkgname=php81-pecl-mailparse
_extname=mailparse
pkgver=3.1.8
pkgrel=0
pkgdesc="PHP 8.1 extension for parsing and working with email messages - PECL"
url="https://pecl.php.net/package/mailparse"
arch="all"
license="PHP-3.01"
depends="php81-mbstring"
makedepends="php81-dev"
source="php-pecl-$_extname-$pkgver.tgz::https://pecl.php.net/get/$_extname-$pkgver.tgz"
builddir="$srcdir/$_extname-$pkgver"

build() {
	phpize81
	./configure --prefix=/usr --with-php-config=php-config81
	make
}

check() {
	# Tests require mbstring extension which is not bundled
	make NO_INTERACTION=1 REPORT_EXIT_STATUS=1 test PHP_TEST_SHARED_EXTENSIONS=" \
		-d extension=/usr/lib/php81/modules/mbstring.so \
		-d extension=modules/$_extname.so" TESTS=--show-diff
}

package() {
	make INSTALL_ROOT="$pkgdir" install
	local _confdir="$pkgdir"/etc/php81/conf.d
	install -d $_confdir
	echo "extension=$_extname" > $_confdir/60_$_extname.ini
}

sha512sums="
d3b7b89f782a1e3d1c24ca7d953978b63818a1a149bff74349b2df268705a7ac912184ca13e185b6bc8cf425878f6c26a909738622e4a41ee3a8cb7d014abeab  php-pecl-mailparse-3.1.8.tgz
"
